<?php
session_start();
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/database.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/functions.php');
require($_SERVER['DOCUMENT_ROOT'].'/resources/lib/class.admin.php');

$admin = new admin();
$admin->canView($_SERVER['PHP_SELF']);
ob_start("sanitize_output"); 
// add new form.. - name

?>
<div class="oneem" style="height:90%;">
<div class="qt-tab-wrapper" style="height:90%;">
<ul class="qt">
<li><a href="#t1-pages" id="tt1" class="qta">Forms</a></li>
<li><a href="#t2-pages" id="tt2" class="qta">Edit</a></li>

</ul>
<div id="t1-pages" class="qt-content-container" style="display:none;">
	<div style="float:left;width:40%;">
    <h2>Add a new form</h2>
    <form class="inline" action="/admin/resources/php/requests/actions/add-new-form.php" method="post" enctype="multipart/form-data">
    	<input type="hidden" class="settings" value='{"buttonWaitingValue":"Adding form","updateNode":"#response"}' />	
		<label>Form Name:</label><br />
        <input type="text" class="comment-field req" name="form_name" id="form_name" style="width:150px;" />
        <p class="hint">Something memorable i.e contact form</p>
         <label>Form processing button value:</label><br />
        <input type="text" class="comment-field req" name="form_button_waiting_value" id="form_button_waiting_value" value="Processing" style="width:150px;" />
 		<p class="hint">The value of the submit button while the form is being processed</p>
        <label>Process Inline:</label><br />
        <select class="form-field" name="form_inline" id="form_inline" style="width:156px;"><?php echo($admin->selectYesNo(1)); ?></select>
        <p class="hint">Doesn't work with if the form will contain file fields.</p>
        <label>Method:</label><br />
        <select class="form-field" name="form_method" id="form_method" style="width:156px;"><?php echo($admin->methodsAsOptions('post')); ?></select>
        <p class="hint">$_GET or $_POST?</p>
        <label>Enctype:</label><br />
        <select class="form-field" name="form_enctype" id="form_enctype" style="width:156px;"><?php echo($admin->enctypesAsOptions('multipart/form-data')); ?></select>
        <p class="hint">Enctype of the form</p>
       
        <input type="submit" value="Add form" class="button" />
        <p class="hint">Once the form has been added you can edit it on the right where you are able to add the form content and the processing logic.</p>
    </form>
    </div>
    <div style="float:right;width:50%;" id="current_forms"></div>
</div>
<div id="t2-pages" class="qt-content-container" style="display:none;"><h1>Please select a form to edit</h1></div>
</div><!-- End tab wrapper -->
</div><!-- End oneem -->
<script>
$.fn.loader('current_forms_list');

$("#tt1").click();

</script>
